package SingletonPattern.exercise5_2;

public class Triple {
    private static int MAX = 3;
    private int id;
    private static Triple[] instances = new Triple[] {
            new Triple(0),
            new Triple(1),
            new Triple(2)
    };


    public static Triple getInstance(int id) {
        return instances[id];
    }

    private Triple(int id){
        System.out.println("The instance " + id + " is created!");
        this.id = id;
    }

    @Override
    public String toString() {
        return "Triple{" +
                "id=" + id +
                '}';
    }
}
